package cl.uchile.sketchpad.web.controllers.util;

import cl.uchile.sketchpad.persistance.model.Group;
import cl.uchile.sketchpad.persistance.model.Slide;
import cl.uchile.sketchpad.persistance.model.User;

public class SktUtil {

	public static Boolean isTeacher(User user) {
		return User.Type.TEACHER.getValue().equals(user.getType());
	}

	public static Boolean isTeacherOrAdmin(User user) {
		return User.Type.TEACHER.getValue().equals(user.getType()) || User.Type.ADMIN.getValue().equals(user.getType());
	}
	
	public static Boolean isMonitor(User user) {
		return User.Type.MONITOR.getValue().equals(user.getType());
	}
	
	public static Boolean isValidSlideType(String type) {
		Boolean res = false;
		
		for ( Slide.Type validType : Slide.Type.values() )
			res = res || validType.getValue().equals(type);
		
		return res;
	}
	
	public static Boolean isValidGroupType(String type) {
		Boolean res = false;
		
		for ( Group.Type validType : Group.Type.values() )
			res = res || validType.getValue().equals(type);
		
		return res;
	}
	
}
